<template>
	<view class="search">
		<search-topbar @search="search"></search-topbar>
		<view class="bgcolor"></view>
		<scroll-view scroll-y="true" class="scroll-Y">
			<search-content :searchList='searchList'></search-content>
		</scroll-view>
	</view>
</template>

<script>
	import SearchTopbar from "./childSearch/SearchTopbar.vue"
	import SearchContent from "./childSearch/SearchContent.vue"
	
	export default{
		data() {
			return {
				searchList: []
			}
		},
		components:{
			SearchTopbar,
			SearchContent
		},
		methods:{
			search(value){
				if(value !== null && value !== ""){
					uni.request({
						url:"http://www.kangliuyong.com:10002/search",
						data:{
							appkey:"U2FsdGVkX19WSQ59Cg+Fj9jNZPxRC5y0xB1iV06BeNA=",
							name:value
						},
						method:"GET",
						success: (res) => {
							if(res.statusCode == 200 ){
								this.searchList = res.data.result
							}
						}
					})
				}else{
					this.searchList = []
				}
			}
		}
	}
</script>

<style scoped>
	.search{
		height: 100vh;
		position: relative;
	}
	.bgcolor{
		width: 100%;
		height: 200rpx;
		background-color: #0c34ba;
	}
	.scroll-Y{
		position: absolute;
		top: 255rpx;
		left: 20rpx;
		right: 20rpx;
		bottom: 20rpx;
		border: 1rpx solid #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		background-color: #FFFFFF;
		width: 95%;
	}
</style>
